<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>使字符串大写</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.mb-strtoupper" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">mb_strtoupper</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">mb_strtoupper</span> &mdash; <span class="dc-title">使字符串大写</span></p>

 </div>
   
 <div class="refsect1 description" id="refsect1-function.mb-strtoupper-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>mb_strtoupper</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$str</code></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter">$encoding</code><span class="initializer"> = mb_internal_encoding()</span></span>
  ] ) : <span class="type">string</span></div>

  <p class="para rdfs-comment">
    将所有的字母字符转化成大写并返回 <code class="parameter">str</code>。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.mb-strtoupper-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">str</code></dt>

     <dd>

      <p class="para">
       要大写的 <span class="type"><a href="language.types.string.html" class="type string">string</a></span>。
      </p>
     </dd>

    
    
     <dt>
<code class="parameter">encoding</code></dt>

     <dd>

      <p class="para"><code class="parameter">encoding</code>
参数为字符编码。如果省略，则使用内部字符编码。</p>
     </dd>

    
   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.mb-strtoupper-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   <code class="parameter">str</code> 里所有的字母都转换成大写的。
  </p>
 </div>


 <div class="refsect1 unicode" id="refsect1-function.mb-strtoupper-unicode">
  <h3 class="title">Unicode</h3>
  <p class="para">
   更多 Unicode 属性的信息，请参见 <a href="http://www.unicode.org/unicode/reports/tr21/" class="link external">&raquo;&nbsp;http://www.unicode.org/unicode/reports/tr21/</a>。
  </p>
  <p class="para">
   和 <span class="function"><a href="strtoupper.html" class="function">strtoupper()</a></span> 不同的是，“字母”是通过 Unicode 字符属性来确定的。
   因此这个函数不会受语言环境（locale）设置影响，能够转化任何具有“字母”属性的字符，例如 a 变音符号（ä）。
  </p>
</div>


 <div class="refsect1 examples" id="refsect1-function.mb-strtoupper-examples">
  <h3 class="title">范例</h3>
  <p class="para">
   <div class="example" id="example-3195">
    <p><strong>Example #1 <span class="function"><strong>mb_strtoupper()</strong></span> 例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$str&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Mary&nbsp;Had&nbsp;A&nbsp;Little&nbsp;Lamb&nbsp;and&nbsp;She&nbsp;LOVED&nbsp;It&nbsp;So"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$str&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mb_strtoupper</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">$str</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;Prints&nbsp;MARY&nbsp;HAD&nbsp;A&nbsp;LITTLE&nbsp;LAMB&nbsp;AND&nbsp;SHE&nbsp;LOVED&nbsp;IT&nbsp;SO<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>

  <p class="para">
   <div class="example" id="example-3196">
    <p><strong>Example #2 非拉丁 UTF-8 文本的 <span class="function"><strong>mb_strtoupper()</strong></span> 例子</strong></p>
    <div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$str&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">"Τάχιστη&nbsp;αλώπηξ&nbsp;βαφής&nbsp;ψημένη&nbsp;γη,&nbsp;δρασκελίζει&nbsp;υπέρ&nbsp;νωθρού&nbsp;κυνός"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$str&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mb_strtoupper</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'UTF-8'</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">$str</span><span style="color: #007700">;&nbsp;</span><span style="color: #FF8000">//&nbsp;打印了&nbsp;ΤΆΧΙΣΤΗ&nbsp;ΑΛΏΠΗΞ&nbsp;ΒΑΦΉΣ&nbsp;ΨΗΜΈΝΗ&nbsp;ΓΗ,&nbsp;ΔΡΑΣΚΕΛΊΖΕΙ&nbsp;ΥΠΈΡ&nbsp;ΝΩΘΡΟΎ&nbsp;ΚΥΝΌΣ<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.mb-strtoupper-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="mb_strtolower.html" class="function" rel="rdfs-seeAlso">mb_strtolower()</a> - 使字符串小写</span></li>
    <li class="member"><span class="function"><a href="mb_convert_case.html" class="function" rel="rdfs-seeAlso">mb_convert_case()</a> - 对字符串进行大小写转换</span></li>
    <li class="member"><span class="function"><a href="strtoupper.html" class="function" rel="rdfs-seeAlso">strtoupper()</a> - 将字符串转化为大写</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>